//
//  ST_QuestionsCell.swift
//  btvideo
//
//  Created by TT mini on 2022/6/23.
//  Copyright © 2022 JarvanZhang. All rights reserved.
//

import UIKit
import SwifterSwift
import HandyJSON

class ST_QuestionsCell: UITableViewCell {

    private lazy var backView : UIView = {
        let v = UIView()
        v.backgroundColor = .white
        v.cornerRadius = 10
        
        return v
    }()
    
    private lazy var nameLabel : UILabel = {
        let l = UILabel()
        l.textColor = Color.init(hexString: "#333333")
        l.font = .systemFont(ofSize: 14, weight: .regular)
        l.textAlignment = .left
        
        return l
    }()
    
    private lazy var indicator : UIImageView = {
        let i = UIImageView()
        i.image = ST_ImageUtils.imageName("message_question_next")
        
        return i
    }()
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        make_u_i()
        viewLayout()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}

extension ST_QuestionsCell {
    
    func make_u_i() {
        
        contentView.backgroundColor = .clear
        contentView.addSubview(backView)
        backView.addSubviews([nameLabel,indicator])
    }
    
    func viewLayout() {
        
        backView.snp.makeConstraints { make in
            make.top.equalToSuperview()
            make.left.equalToSuperview().offset(15)
            make.width.equalTo(ScreenWidth-30)
            make.bottom.equalToSuperview().offset(-15)
        }
        
        nameLabel.snp.makeConstraints { make in
            make.centerY.equalToSuperview()
            make.left.equalToSuperview().offset(15)
            make.right.equalToSuperview().offset(-38)
            make.height.equalTo(20)
        }
        
        indicator.snp.makeConstraints { make in
            make.centerY.equalToSuperview()
            make.right.equalToSuperview().offset(-12)
            make.width.height.equalTo(16)
        }
    }
    
    func configer_with_infos(model: ST_CommonQuestionListModel) {

        nameLabel.text = model.title
    }
}
